import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserWalletFlowVO, UserWalletFlowForm, UserWalletFlowQuery } from '@/api/system/userWalletFlow/types';

/**
 * 查询用户钱包流水列表
 * @param query
 * @returns {*}
 */

export const listUserWalletFlow = (query?: UserWalletFlowQuery): AxiosPromise<UserWalletFlowVO[]> => {
  return request({
    url: '/system/userWalletFlow/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户钱包流水详细
 * @param walletFlowId
 */
export const getUserWalletFlow = (walletFlowId: string | number): AxiosPromise<UserWalletFlowVO> => {
  return request({
    url: '/system/userWalletFlow/' + walletFlowId,
    method: 'get'
  });
};

/**
 * 新增用户钱包流水
 * @param data
 */
export const addUserWalletFlow = (data: UserWalletFlowForm) => {
  return request({
    url: '/system/userWalletFlow',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户钱包流水
 * @param data
 */
export const updateUserWalletFlow = (data: UserWalletFlowForm) => {
  return request({
    url: '/system/userWalletFlow',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户钱包流水
 * @param walletFlowId
 */
export const delUserWalletFlow = (walletFlowId: string | number | Array<string | number>) => {
  return request({
    url: '/system/userWalletFlow/' + walletFlowId,
    method: 'delete'
  });
};
